home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / others / justify.zip / JUSTIFY.DOC < prev    next >
Text File  |  1993-12-17  |  7KB  |  166 lines

  1. JUSTIFY.EXE -- By Tom Almy
  2.  
  3. Copyright 1993 by Tom Almy
  4.  
  5. May be freely used and distributed as long as no chage is made beyond
  6. distribution costs and program is not modified.
  7.  
  8.  
  9. DESCRIPTION
  10.  
  11. Justify will reformat already formatted text.  It will ignore titles
  12. and other header information and reformat paragraphs to any desired
  13. style.  JUSTIFY is run from the command line.  Source code is
  14. provided.
  15.  
  16.  
  17. PREPARATION
  18.  
  19. The input text must be stripped of all tab characters.  JUSTIFY must
  20. be able to deturmine what constitutes a paragraph.  It is important
  21. that the input text be consistantly formatted.  JUSTIFY cannot
  22. reformat tables.  In some cases it may be desirable to break the
  23. input file into pieces, and use JUSTIFY with different settings on
  24. each piece or just some pieces.
  25.  
  26. Running JUSTIFY with no arguments gives the following usage
  27. information: 
  28.  
  29.  justify columns [b][f][d][i][t][o][h][s][r] [indent] [body] <source >dest
  30.    b - input file paragraph is hanging indented
  31.    f - input file paragraph is fully indented
  32.    d - delete blank line after paragraph read
  33.    i - insert blank line after paragraph read
  34.    t - indent first paragraph lines by indent spaces
  35.    o - indent other paragraph lines by body spaces
  36.    h - remove hyphens across line boundaries
  37.    s - double space after . ? ! ." ?" or !"
  38.    w - output for word processors
  39.    r - ragged right margin (otherwise full justification)
  40.  
  41.  
  42. The "b", "f", and "h" options (and to a certain extent the "d" and
  43. "i" options) deal with parsing the input text. 
  44.  
  45. When the paragraphs are have "hanging indents" -- the first line is
  46. flush against the left margin and all remaining paragraph lines are
  47. indented -- then you need to use the "b" option.
  48.  
  49. When the paragraphs are set off from the left margin, and title
  50. information is flush against the left margin, then you need to use
  51. the "f" option.
  52.  
  53. No option needs to be specified for block paragraphs flush against
  54. the left margin, or paragraphs with first line indents.  If headers
  55. and paragraphs are both indented, then leading spaces must be removed
  56. so that JUSTIFY can differentiate between the two.  The program
  57. UNOFFSET can be used to do this.
  58.  
  59. If the input text uses hyphenation across line boundaries (common in
  60. scanned text), this hyphenation must be removed.  Use the "h" option
  61. to do this. The output text should be spell checked because sometimes
  62. line breaks split normally hypenated words into two pieces, and
  63. JUSTIFY will remove hyphens from those as well! If the "h" option is
  64. not specified the words crossing line boundaries will assume to be
  65. hypenated, and the hyphen won't be removed (example: brother-
  66. in-law.)
  67.  
  68.  
  69. SELECTING THE OUTPUT FORMAT
  70.  
  71. The "columns" argument must be specified, and is the number of
  72. columns of text to output.  The indent options, "t" and "o" will
  73. reduce that number, but the right hand margin will stay the same.
  74. Title and header lines are not processed, so they can be longer than
  75. the columns figure.
  76.  
  77. The values given for columns, indent, and body should be reasonable!
  78.  
  79. To format with indented paragraphs (first line indented, remainder of
  80. the lines flush with the left margin), specify the "t" option, and
  81. provide the indent argument for the number of columns to indent the
  82. first line of the paragraph.  Headers and titles are not indented.
  83.  
  84. For a hanging indent, specify the "o" option, and provide the body
  85. indent argument.
  86.  
  87. For block paragraphs, nothing need be done, but if it is desired to
  88. indent entire paragraphs, specify both the "t" and "o" options, and
  89. specify indent and body values that are identical.
  90.  
  91. Block paragraphs are identifiable by there being a blank line between
  92. the paragraphs.  Indented paragraphs often do not have blank lines
  93. between paragraphs.  When an text file with indented paragraphs is
  94. converted to one with block paragraphs, often it is necessary to
  95. insert a blank line between the paragraphs.  The "i" option will
  96. insert a blank line after each paragraph.  Conversely, when
  97. converting from block paragraphs to indented paragraphs, it is often
  98. desirable to delete the blank line between paragraphs.  The "d"
  99. option will delete any blank line after a paragraph.
  100.  
  101. JUSTIFY does full justification (even left and right margins) by
  102. default, however the "r" option can be used to output ragged right
  103. margins.  With full justification, spaces are inserted from the left
  104. and from the right on alternate lines. 
  105.  
  106. JUSTIFY removes spaces from input text.  The "s" option will insure
  107. two spaces after each sentence.  This is a common practice when
  108. ragged right margins are used.
  109.  
  110. It is possible to produce output intended for word proccessor
  111. programs. When the option "w" is specified, the columns value is
  112. ignored, as well as the "t", "o", and "r" options. Each paragraph is
  113. output as a single long line. Most word processor programs, when fed
  114. text this way (as an "ASCII Import"), will reformat the text as a
  115. paragraph. 
  116.  
  117.  
  118. RUNNING THE PROGRAM
  119.  
  120. This file, justify.doc, makes a suitable source file for
  121. reformatting.  It has block paragraphs, ragged right formatted with
  122. 70 columns.
  123.  
  124. Example to reformat to 50 columns, with full justification:
  125.  
  126.   justify 50 <justify.doc >justify.txt
  127.  
  128. When you do this, you will note that the "usage" table does not get
  129. reformatted.  This is luck, caused by the table not being recognized
  130. by the program.  On the other hand, the line above starting "Example"
  131. will be treated like a header line and won't be reformatted although
  132. it should be.  Output text will typically need to be cleaned up, but
  133. the time spent doing this should be very small for books.
  134.  
  135. Example to reformat to 75 columns, first line indented 5 columns, no
  136. space between paragraphs, ragged right with two spaces after sentence
  137. ends:
  138.  
  139.    justify 75 dtsr 5 <justify.doc >justify.txt
  140.  
  141. When you do this, you will see that deleting lines does not always
  142. work.  Some additional cleanup is necessary.  Before doing so,
  143. convert this new file to 70 columns, paragraphs indented 5 columns
  144. (blocked), reinsert blank lines between paragraphs:
  145.  
  146.    justify 70 ito 5 5 <justify.txt >justify.tx2
  147.  
  148. Reformat to the first 50 column format.  We now need to specify that
  149. the file has full indented paragraphs.
  150.  
  151.    justify 50 f <justify.tx2 >justify.tx3
  152.  
  153. Pretty good, but the usage table is messed up because JUSTIFY could
  154. not tell it from a paragraph.
  155.  
  156.  
  157. CONCLUSION
  158.  
  159. I hope you find this program useful. I have!
  160.  
  161. Tom Almy
  162. Internet: tom.almy@tek.com
  163. Fidonet: 1:105/290
  164.  
  165. 12/17/93
  166.